<template>
    <view>
        <block v-for="(value, index) in listData" :key="index">
            <view class="uni-list-cell" hover-class="uni-list-cell-hover" @click="checkFollowRecord(value)">
                <view class="uni-media-list">
                    <text class="uni-media-list-logo">{{value.realname | filterUserName}}</text>
                    <view class="uni-media-list-body">
                        <view class="uni-media-list-text-top">
                            <text style="font-size: 28rpx;font-weight: bold;margin-right: 20rpx;">{{value.realname}}</text>
                            <text style="font-size: 20rpx;">创建时间：{{value.createTime ? value.createTime : '--'}}</text>
                        </view>
                        <view class="uni-media-list-text-bottom">
                            <text style="margin-right: 20rpx;">{{ value.category ? value.category : '--'}}</text>
                            <text style="padding-left: 20rpx;border-left: 1px solid ;">{{ value.customerName}}</text>
                        </view>
                        <view style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;width: 600rpx" v-html="'跟进内容： '+ (value.contentOne ? value.contentOne : value.content)">跟进内容：{{ value.contentOne ? value.contentOne : value.content}}</view>
                        <view style="display: flex;flex-direction: row;align-items: center">
                            <text>联系人：</text>
                            <view style="display: flex;flex-wrap: wrap;">
                                <u-tag style="margin-right: 10rpx;" v-for="(contact,contactIndex) in value.contactsList"
                                    :key="contactIndex" :text="contact.name" size="mini" mode="plain" type="primary"></u-tag>
                            </view>
                        </view>
                        <view>下次联系时间：{{value.nextTime ? value.nextTime : '--'}}</view>
                    </view>
                </view>
            </view>
        </block>
    </view>
</template>

<script>
    import common from '../../mixins/common.js';
    export default {
        mixins: [common],
        props: {
            listData: {
                type: Array,
                default: {
                    return: []
                }
            },
        },
        filters: {
            filterUserName(name) {
                if (name) {
                    return name.substring(name.length - 2, name.length)
                }
            }
        },
        methods: {
            checkFollowRecord(item) {
                uni.navigateTo({
                    url: "/pages/customerManagement/followRecord/followRecordInfo?recordId=" + item.recordId
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
    @import '@/pages/customerManagement/styles/list.scss';
</style>
